/*
 * THE SOURCE CODES OF THE SOFTWARE ARE VALUABLE ASSETS OF FIDUS TECHNOLOGIES LTD.
 * YOU AGREE TO KEEP ALL SOURCE CODES OF THE SOFTWARE IN CONFIDENCE. YOU MAY NOT TRANSFER
 * OR ASSIGN THE SOFTWARE OR YOUR RIGHTS UNDER THIS AGREEMENT.
 * LIMITED WARRANTY
 * THE SOFTWARE AND ACCOMPANYING WRITTEN MATERIALS (INCLUDING INSTRUCTIONS FOR USE) ARE PROVIDED "AS IS"
 * AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. YOU ASSUME THE ENTIRE
 * RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE.
 * FIDUS TECHNOLOGIES DOES NOT WARRANT THAT THE SOFTWARE WILL MEET ALL YOUR REQUIREMENTS, THAT OPERATIONS
 * OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ALL SOFTWARE ERRORS WILL BE CORRECTED.
 * FIDUS TECHNOLOGIES-SOFTWARE SOLUTIONS IS NOT RESPONSIBLE FOR PROBLEMS CAUSED BY CHANGES IN THE
 * OPERATING CHARACTERISTICS OF COMPUTER HARDWARE OR COMPUTER OPERATING SYSTEMS WHICH ARE MADE AFTER
 * WHICH ARE MADE AFTER THE RELEASE OF THE SOFTWARE NOR FOR PROBLEMS IN THE INTERACTION OF THE SOFTWARE
 * WITH NON-FIDUS TECHNOLOGIES APPLICATION.WILL HAVE NO RESPONSIBILITY TO REPLACE OR REFUND THE LICENSE FEES
 * FOR MEDIA DAMAGED BY ACCIDENT, ABUSE OR MISAPPLICATION. THIS SOFTWARE IS INTENDED FOR COMMERCIAL,
 * INSTITUTIONAL, AND INDUSTRIAL USERS. THE ABOVE WARRANTIES ARE EXCLUSIVE AND IN LIEU OF ALL OTHER WARRANTIES,
 * WHETHER EXPRESSED OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NON-INFRINGEMENT. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY FIDUS TECHNOLOGIES,
 * ITS EMPLOYEES, DISTRIBUTORS, DEALERS OR AGENTS SHALL INCREASE THE SCOPE OF THE ABOVE WARRANTIES OR
 * CREATE ANY NEW WARRANTIES. NEITHER FIDUS TECHNOLOGIES NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE
 * CREATION, PRODUCTION OR DELIVERY OF THE SOFTWARE SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL
 * OR INCIDENTAL DAMAGES (INCLUDING DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS LOSSES, BUSINESS
 * INTERRUPTION, LOSS OF DATA, AND THE LIKE) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE,
 * OR ANY OTHER CLAIM BY ANY PARTY EVEN IF FIDUS TECHNOLOGIES HAS BEEN ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGES. IN THE EVENT FIDUS TECHNOLOGIES IS LIABLE FOR ANY DAMAGES, FIDUS TECHNOLOGIES' LIABILITY
 * FOR DAMAGES SHALL BE LIMITED TO THE AMOUNT PAID FOR THE SOFTWARE UNDER THE TERMS AND CONDITIONS OF THIS
 * AGREEMENT.
 * http://www.fidustechnologies.com
 * Copyright(C) 2010 FIDUS TECHNOLOGIES-Software Solutions(R)
 * All rights reserved.
 */

/*
 * SearchItem.java
 *
 * Created on 6 Sep, 2010, 12:21:35 PM
 */

package com.fidus.inventory.UI.Items;

import com.fidus.inventory.UI.CallableComponent;
import com.fidus.inventory.beans.items.ItemDetails;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.List;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import oracle.toplink.essentials.expressions.ExpressionBuilder;
import oracle.toplink.essentials.queryframework.ReadAllQuery;
import org.jdesktop.application.Action;

/**
 *
 * @author Mahesh Kedari<mahesh.kedari@fidustechnologies.com>
 */
public class SearchItem extends javax.swing.JPanel implements CallableComponent{
    private static String dockable_ID;
    /** Creates new form SearchItem */
    public SearchItem() {
        initComponents();
        itemsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent lse) {
                propertyChangeSupport.firePropertyChange(PROP_ITEMSELECTED, !isItemSelected(), isItemSelected());
            }
        });
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("inventorymanagement_dbPU").createEntityManager();
        itemDetailsQuery = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT i FROM ItemDetails i");
        itemDetailsList = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : itemDetailsQuery.getResultList();
        jPopupMenu1 = new javax.swing.JPopupMenu();
        refreshListMenu = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        viewDetailsMenu = new javax.swing.JMenuItem();
        deleteMenu = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        purchaseOrderMenu = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        printMenu = new javax.swing.JMenu();
        printSingleMenuItem = new javax.swing.JMenuItem();
        printListMenuItem = new javax.swing.JMenuItem();
        searchPanel = new org.jdesktop.swingx.JXTitledPanel();
        searchForLabel = new javax.swing.JLabel();
        searchForTextField = new javax.swing.JTextField();
        searchTypeLabel = new javax.swing.JLabel();
        searchTypeComboBox = new javax.swing.JComboBox();
        matchTypeLabel = new javax.swing.JLabel();
        matchTypeComboBox = new javax.swing.JComboBox();
        searchButton = new javax.swing.JButton();
        clearButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        itemsTable = new org.jdesktop.swingx.JXTable();

        jPopupMenu1.setName("jPopupMenu1"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(simple_inventory.Simple_InventoryApp.class).getContext().getActionMap(SearchItem.class, this);
        refreshListMenu.setAction(actionMap.get("refresh")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(simple_inventory.Simple_InventoryApp.class).getContext().getResourceMap(SearchItem.class);
        refreshListMenu.setText(resourceMap.getString("refreshListMenu.text")); // NOI18N
        refreshListMenu.setName("refreshListMenu"); // NOI18N
        jPopupMenu1.add(refreshListMenu);

        jSeparator1.setName("jSeparator1"); // NOI18N
        jPopupMenu1.add(jSeparator1);

        viewDetailsMenu.setAction(actionMap.get("viewDetails")); // NOI18N
        viewDetailsMenu.setText(resourceMap.getString("viewDetailsMenu.text")); // NOI18N
        viewDetailsMenu.setName("viewDetailsMenu"); // NOI18N
        jPopupMenu1.add(viewDetailsMenu);

        deleteMenu.setAction(actionMap.get("deleteItem")); // NOI18N
        deleteMenu.setText(resourceMap.getString("deleteMenu.text")); // NOI18N
        deleteMenu.setName("deleteMenu"); // NOI18N
        jPopupMenu1.add(deleteMenu);

        jSeparator2.setName("jSeparator2"); // NOI18N
        jPopupMenu1.add(jSeparator2);

        purchaseOrderMenu.setAction(actionMap.get("setPurchaseOrder")); // NOI18N
        purchaseOrderMenu.setText(resourceMap.getString("purchaseOrderMenu.text")); // NOI18N
        purchaseOrderMenu.setName("purchaseOrderMenu"); // NOI18N
        jPopupMenu1.add(purchaseOrderMenu);

        jSeparator3.setName("jSeparator3"); // NOI18N
        jPopupMenu1.add(jSeparator3);

        printMenu.setText(resourceMap.getString("printMenu.text")); // NOI18N
        printMenu.setName("printMenu"); // NOI18N

        printSingleMenuItem.setAction(actionMap.get("printSingle")); // NOI18N
        printSingleMenuItem.setText(resourceMap.getString("printSingleMenuItem.text")); // NOI18N
        printSingleMenuItem.setName("printSingleMenuItem"); // NOI18N
        printMenu.add(printSingleMenuItem);

        printListMenuItem.setAction(actionMap.get("printList")); // NOI18N
        printListMenuItem.setText(resourceMap.getString("printListMenuItem.text")); // NOI18N
        printListMenuItem.setName("printListMenuItem"); // NOI18N
        printMenu.add(printListMenuItem);

        jPopupMenu1.add(printMenu);

        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(237, 593));

        searchPanel.setTitle(resourceMap.getString("searchPanel.title")); // NOI18N
        searchPanel.setName("searchPanel"); // NOI18N
        searchPanel.setPreferredSize(new java.awt.Dimension(237, 203));

        searchForLabel.setText(resourceMap.getString("searchForLabel.text")); // NOI18N
        searchForLabel.setName("searchForLabel"); // NOI18N

        searchForTextField.setText(resourceMap.getString("searchForTextField.text")); // NOI18N
        searchForTextField.setName("searchForTextField"); // NOI18N

        searchTypeLabel.setText(resourceMap.getString("searchTypeLabel.text")); // NOI18N
        searchTypeLabel.setName("searchTypeLabel"); // NOI18N

        searchTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Code", "Name", "Description" }));
        searchTypeComboBox.setName("searchTypeComboBox"); // NOI18N

        matchTypeLabel.setText(resourceMap.getString("matchTypeLabel.text")); // NOI18N
        matchTypeLabel.setName("matchTypeLabel"); // NOI18N

        matchTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Contains", "Exact" }));
        matchTypeComboBox.setName("matchTypeComboBox"); // NOI18N

        searchButton.setAction(actionMap.get("searchItem")); // NOI18N
        searchButton.setText(resourceMap.getString("searchButton.text")); // NOI18N
        searchButton.setName("searchButton"); // NOI18N

        clearButton.setAction(actionMap.get("clearForm")); // NOI18N
        clearButton.setText(resourceMap.getString("clearButton.text")); // NOI18N
        clearButton.setName("clearButton"); // NOI18N

        javax.swing.GroupLayout searchPanelLayout = new javax.swing.GroupLayout(searchPanel.getContentContainer());
        searchPanel.getContentContainer().setLayout(searchPanelLayout);
        searchPanelLayout.setHorizontalGroup(
            searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(searchPanelLayout.createSequentialGroup()
                        .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(searchForLabel)
                            .addComponent(searchTypeLabel))
                        .addGap(18, 18, 18)
                        .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(searchTypeComboBox, 0, 112, Short.MAX_VALUE)
                            .addComponent(searchForTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)))
                    .addGroup(searchPanelLayout.createSequentialGroup()
                        .addComponent(matchTypeLabel)
                        .addGap(24, 24, 24)
                        .addComponent(matchTypeComboBox, 0, 112, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(searchPanelLayout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addComponent(searchButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                .addComponent(clearButton)
                .addGap(26, 26, 26))
        );
        searchPanelLayout.setVerticalGroup(
            searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(searchPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(searchForTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(searchForLabel))
                .addGap(13, 13, 13)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(searchTypeLabel)
                    .addComponent(searchTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(matchTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(matchTypeLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(searchButton)
                    .addComponent(clearButton)))
        );

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        itemsTable.setColumnSelectionAllowed(true);
        itemsTable.setName("itemsTable"); // NOI18N

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, itemDetailsList, itemsTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${itemCode}"));
        columnBinding.setColumnName("Item Code");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${itemName}"));
        columnBinding.setColumnName("Item Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        itemsTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                itemsTableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(itemsTable);
        itemsTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        itemsTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("itemsTable.columnModel.title0")); // NOI18N
        itemsTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("itemsTable.columnModel.title1")); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(searchPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(searchPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE))
        );

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

    private void itemsTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_itemsTableMouseClicked
        /* Check if the button clicked is Right mouse button. If yes show the popup menu*/
        if(evt.getButton()==MouseEvent.BUTTON3){
            jPopupMenu1.show(itemsTable, evt.getX(), evt.getY());
        }
    }//GEN-LAST:event_itemsTableMouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton clearButton;
    private javax.swing.JMenuItem deleteMenu;
    private javax.persistence.EntityManager entityManager;
    private java.util.List<com.fidus.inventory.beans.items.ItemDetails> itemDetailsList;
    private javax.persistence.Query itemDetailsQuery;
    private org.jdesktop.swingx.JXTable itemsTable;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JComboBox matchTypeComboBox;
    private javax.swing.JLabel matchTypeLabel;
    private javax.swing.JMenuItem printListMenuItem;
    private javax.swing.JMenu printMenu;
    private javax.swing.JMenuItem printSingleMenuItem;
    private javax.swing.JMenuItem purchaseOrderMenu;
    private javax.swing.JMenuItem refreshListMenu;
    private javax.swing.JButton searchButton;
    private javax.swing.JLabel searchForLabel;
    private javax.swing.JTextField searchForTextField;
    private org.jdesktop.swingx.JXTitledPanel searchPanel;
    private javax.swing.JComboBox searchTypeComboBox;
    private javax.swing.JLabel searchTypeLabel;
    private javax.swing.JMenuItem viewDetailsMenu;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
    private ExpressionBuilder expressionBuilder = new ExpressionBuilder(ItemDetails.class);

    //<editor-fold defaultstate="collapsed" desc="Actions for search panel">
    /**
     * This function will search the selected criteria in Items list and display
     * matching results in table.
     */
    @Action
    public void searchItem(){
        //TODO search Item

    }

    /**
     * This function will clear the search criteria and reset the result list.
     */
    @Action
    public void clearForm(){
        //Reset the form
        searchForTextField.setText("");
        searchTypeComboBox.setSelectedIndex(0);
        matchTypeComboBox.setSelectedIndex(0);

        /*Execute ReadAll query to get all the records in result*/
        ReadAllQuery rq;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Popup Menu Action Handling">
    @Action
    public void refresh(){
        List<ItemDetails> temporaryList = entityManager.createNamedQuery("ItemDetails.findAll").getResultList();
        itemDetailsList.removeAll(itemDetailsList);
        itemDetailsList.addAll(temporaryList);
    }

    protected boolean itemSelected;
    public static final String PROP_ITEMSELECTED = "itemSelected";

    /**
     * Check if any record is selected in Table
     *
     * @return true if records is selected
     *         false if no record is selected
     */
    public boolean isItemSelected() {
        return itemsTable.getSelectedRow()!=-1;
    }

    /**
     * Set the value of itemSelected
     *
     * @param itemSelected new value of itemSelected
     */
    public void setItemSelected(boolean itemSelected) {
        boolean oldItemSelected = this.itemSelected;
        this.itemSelected = itemSelected;
        propertyChangeSupport.firePropertyChange(PROP_ITEMSELECTED, oldItemSelected, itemSelected);
    }

    /**
     * This action will view details of selected Item
     */
        @Action(enabledProperty = "itemSelected")
    public void viewDetails(){
        //TODO view details of selected Item
    }

    /**
     * This action will delete selected item
     */
    @Action(enabledProperty = "itemSelected")
    public void deleteItem(){
        int selectedCount = itemsTable.convertRowIndexToModel(itemsTable.getSelectedRow());
        ItemDetails toRemove = itemDetailsList.remove(selectedCount);
        entityManager.remove(toRemove);
    }

    /**
     * This action will navigate user to new item creation screen
     */
    @Action
    public void newItem(){
        //TODO Add new Item
    }
    
    /**
     * This action will create new purchase order with selected item added in
     * table
     */
        @Action(enabledProperty="itemSelected")
    public void setPurchaseOrder(){
       //TODO new purchase order of selected Item
    }

    /**
     * This action will print selected Item details
     */
        @Action(enabledProperty="itemSelected")
    public void printSingle(){
        //TODO print selected Item details
    }

    /**
     * This action will print complete list of Items displayed.
     */
    @Action
    public void printList(){
       //TODO print complete list of Items
    }

    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Property Change Support">
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    /**
     * Add PropertyChangeListener.
     *
     * @param listener
     */
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Remove PropertyChangeListener.
     *
     * @param listener
     */
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }

    //</editor-fold>

    public void callingMethod(Object... object) {
        /* Nothing needs to be set when calling this dockable */
    }

    public Object getDockedObject() {
        return this;
    }

    public String getDockedID() {
        return dockable_ID;        
    }

    public void setDockedID(String dockable_ID){
        this.dockable_ID = dockable_ID;
    }

}
